hdu 5540 Secrete Master Plan

  水题,直接看旋转1~3次四个数相不相同。

  Github: https://github.com/wmpeng/Algorithm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <stdio.h>
using namespace std;

int a[2][2], b[2][2];
bool j()
{
for (int i = 0; i<2; i++)
for (int j = 0; j<2; j++)
if (a[i][j] != b[i][j]) return false;
return true;
}

void zhuan()
{
int tmp = a[0][0];
a[0][0] = a[1][0];
a[1][0] = a[1][1];
a[1][1] = a[0][1];
a[0][1] = tmp;
}
int main()
{
int t, cnt = 0;
scanf("%d", &t);
while (t--)
{
for (int i = 0; i<2; i++)
for (int j = 0; j<2; j++)
scanf("%d", &a[i][j]);
for (int i = 0; i<2; i++)
for (int j = 0; j<2; j++)
scanf("%d", &b[i][j]);

bool f = false;
for (int i = 0; i<4; i++)
{
if (j()) f = true;
zhuan();
}
if (f)
printf("Case #%d: POSSIBLE\n", ++cnt);
else
printf("Case #%d: IMPOSSIBLE\n", ++cnt);
}
return 0;
}